<?php

#--------------------------------------------------
# ALL INCLUDES + STANDARD-VALUES
#--------------------------------------------------
include_once ("include/config.inc");
include_once ("include/global_fix_extern.inc");
include_once ("include/template.inc");
include_once ("include/class.db.php5");
include_once ("include/class.tools.php5");
include_once ("include/class.time.php5");
include_once ("include/bday.php5");

// db access
include_once ("dataAccess/classes/Schule.php5");
include_once ("dataAccess/classes/TextProperty.php5");
include_once ("dataAccess/dao/SchuleDAO.php5");
include_once ("dataAccess/dao/TextPropertyDAO.php5");

$svo = new db("svoptik");
$tools = new tool();
$time = new TimeUtil();

#--------------------------------------------------
# CREATE TEMPLATE
#--------------------------------------------------
$t = new Template("templates", "keep");
$t->set_file(array (
	"page" => "svoptik.tpl",
	"navi" => "navi.tpl",
	"ticker" => "ticker.tpl",
	"schule" => "schule.tpl",
	"header" => "schule_header.tpl",
	"game" => "game.tpl"
));
#--------------------------------------------------
#--------------------------------------------------
# CREATE NAVIGATION RIGHT
#--------------------------------------------------
$links = "";
//$url[] = array("URL" => "#top",     "URL-TEXT" => "Verein");
//$url[] = array("URL" => "#herren",  "URL-TEXT" => "Herren I");
//$url[] = array("URL" => "#herren2", "URL-TEXT" => "Herren II");
//$url[] = array("URL" => "#u20",     "URL-TEXT" => "U 20 I");
$url[0] = array (
	"URL" => "",
	"URL-TEXT" => ""
);
for ($i = 0; $i < count($url); $i++) {
	$links .= "
	        <tr height=\"15\">
				<td valign=\"top\"><img src=\"standard/spacer.gif\" width=\"20\" height=\"15\" border=\"0\" alt=\"\"></td>
				<td valign=\"top\"><a href=\"" . $url[$i]['URL'] . "\" class=\"sitenav\">" . $url[$i]['URL-TEXT'] . "</a></td>
				<td valign=\"top\"><img src=\"standard/spacer.gif\" width=\"20\" height=\"15\" border=\"0\" alt=\"\"></td>
			</tr>
	       ";
}
$t->set_var(array (
	"LINKS" => $links,
	"BANNER" => $banner
));
$right_nav = $t->parse("", "navi", true);
#--------------------------------------------------

#--------------------------------------------------
# CREATE ALL-TIME SAME THINGS
#--------------------------------------------------
include_once ("include/sameThings.php5");

#--------------------------------------------------
# CREATE CONTENT "schuleEN"
#--------------------------------------------------

$content = "";
$dao = new SchuleDAO();
$propDao = new TextPropertyDAO();

$schulen = $dao->findAllSortedByPos();

// header setzen
$prop = $propDao->findByUnique("SCHOOLS","DESCRIPTION");
$t->set_var(array (
			"DESCRIPTION" => $prop->value));
$content .= $t->parse("", "header", true);

if ($schulen){
	foreach ($schulen as $schule){
		$image = "";
		if (!empty($schule->foto)){
			$image= '<a href="images/schools/'.$schule->foto.'" target="_blank">
						<img src="images/schools/'.$schule->foto.'" alt="'.$schule->name.'" title="'.$schule->name.'" border="0" height="100"/>
					</a>';
		}
		$t->set_var(array (
			"ID" => $schule->id,
			"NAME" => $schule->name,
			"STREET" => $schule->adr_street,
			"PLZ" => $schule->adr_plz,
			"CITY" => $schule->adr_town,
			"TERMIN" => $schule->termin,
			"TEL" => $schule->tel,
			"ANSPRECHPARTNER" => $schule->ansprechpartner,
			"FOTO" => $image,
			"HOMEPAGE" => $schule->homepage,
			"MSG" => $msg
		));
		$content .= $t->parse("", "schule", true);
	}
}
	

#--------------------------------------------------

#--------------------------------------------------
# PARSE & OUTPUT
#--------------------------------------------------
$t->set_var(array (
	"sitenav" => "EAGLES @ SCHOOL -> &Uuml;BERSICHT",
	"ticker" => $ticker,
	"content" => $content . "<br>",
	"navi" => $right_nav,
	"SYNCHRONIZE" => " "
));

$t->parse("ALL", "page", true);
$t->p("ALL");
?>
